package com.duoec.dw.lineage.dto;

import java.util.Objects;

/**
 * 表字段上游依赖关系
 *
 * @author xuwenzhen
 */
public class TableFieldDependencyDto extends TableCoordinateDto {
    /**
     * 字段名
     */
    private String fieldName;

    public String getFieldName() {
        return fieldName;
    }

    public void setFieldName(String fieldName) {
        this.fieldName = fieldName;
    }

    @Override
    public String toString() {
        return super.toString() + "." + fieldName;
    }

    public String getTableFullName() {
        return super.toString();
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        if (!super.equals(o)) {
            return false;
        }
        TableFieldDependencyDto that = (TableFieldDependencyDto) o;
        return Objects.equals(databaseName, that.databaseName) &&
                Objects.equals(tableName, that.tableName) &&
                Objects.equals(fieldName, that.fieldName);
    }

    @Override
    public int hashCode() {
        return Objects.hash(super.hashCode(), fieldName);
    }
}
